package Data_Structure.List.MyList;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Scanner;

/**
 * @className: Test
 * @author: 芃
 * @description: 顺序表和链表测试
 * @date: 2023/8/16 14:42
 */
public class Test {
    public static void main(String[] args) {
        MyLinkedList2 myLinkedList2 = new MyLinkedList2();
        myLinkedList2.addFirst(1);
        myLinkedList2.display();
        myLinkedList2.addEnd(2);
        myLinkedList2.display();
    }
    public static void main7(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNextLine()){
            String str1 = scanner.nextLine();
            String str2 = scanner.nextLine();
            ArrayList<Character> list1 = new ArrayList<>();
            ArrayList<Character> list2 = new ArrayList<>();
            for (int i = 0; i < str2.length(); i++) {
                list2.add(str2.charAt(i));
            }
            for (int i = 0; i < str1.length(); i++) {
                if (!list2.contains(str1.charAt(i))){
                    list1.add(str1.charAt(i));
                }
            }
            StringBuilder stringBuilder = new StringBuilder();
            for (Character character : list1) {
                stringBuilder.append(character);
            }
            System.out.println(stringBuilder.toString());
        }
    }
    public static void main6(String[] args) {
        MyLinkedList myLinkedList = new MyLinkedList();
        myLinkedList.addFirst(7);
        myLinkedList.addFirst(6);
        myLinkedList.addFirst(5);
        myLinkedList.addFirst(4);
        myLinkedList.addFirst(3);
        myLinkedList.addFirst(2);
        myLinkedList.addFirst(1);
        myLinkedList.addFirst(0);
        myLinkedList.addIndex(2,15);
        System.out.println(myLinkedList.contains(15));
    }
    public static void main5(String[] args) {

        MyLinkedList2 myLinkedList2 = new MyLinkedList2();
        myLinkedList2.addEnd(1);
        myLinkedList2.addEnd(2);
        myLinkedList2.addEnd(3);
        myLinkedList2.addEnd(4);
        myLinkedList2.addEnd(5);
        myLinkedList2.addEnd(6);
        myLinkedList2.display();
        System.out.println();
        myLinkedList2.addIndex(5,33);
        myLinkedList2.display();
        myLinkedList2.clear();
        System.out.println();
        myLinkedList2.display();
    }
    public static void main0(String[] args) {

        MyLinkedList2 myLinkedList2 = new MyLinkedList2();
        myLinkedList2.addEnd(1);
        myLinkedList2.addEnd(1);
        myLinkedList2.addEnd(1);
        myLinkedList2.addEnd(1);
        myLinkedList2.addEnd(1);
        myLinkedList2.addEnd(1);
        myLinkedList2.display();
        myLinkedList2.removeAllKey(1);
        System.out.println();
        myLinkedList2.display();
    }
    public static void main3(String[] args) {
        MyLinkedList2 myLinkedList2 = new MyLinkedList2();
        myLinkedList2.addEnd(1);
        myLinkedList2.addEnd(2);
        myLinkedList2.addEnd(3);
        myLinkedList2.addEnd(4);
        myLinkedList2.addEnd(5);
        myLinkedList2.addEnd(6);
        myLinkedList2.display();
        System.out.println();
        System.out.println(myLinkedList2.contains(4));
        myLinkedList2.addFirst(0);
        myLinkedList2.display();
        System.out.println();
        myLinkedList2.remove(0);
        myLinkedList2.display();
        System.out.println();
        myLinkedList2.remove(6);
        myLinkedList2.display();
        System.out.println();
        myLinkedList2.remove(3);
        myLinkedList2.display();
    }
    public static void main2(String[] args) {
        MyArrayList myArrayList = new MyArrayList();
        myArrayList.setIndexValue(0,1);
        myArrayList.setIndexValue(1,2);
        myArrayList.setIndexValue(2,3);
        myArrayList.setIndexValue(3,4);
        myArrayList.setIndexValue(4,5);
        myArrayList.setIndexValue(5,6);
        myArrayList.setIndexValue(6,7);
        myArrayList.setIndexValue(7,8);
        myArrayList.setIndexValue(8,9);
        myArrayList.setIndexValue(9,10);
        myArrayList.print();
        System.out.println("=============");
        myArrayList.setIndexValue(3,13);
        myArrayList.change(0,15);
        System.out.println(myArrayList.isContain(15));
        System.out.println(myArrayList.getValueByIndex(0));
        myArrayList.print();

    }
    public static void main1(String[] args) {
        ArrayList<Integer> list = new ArrayList<>();//顺序表
        System.out.println(list.size());
        LinkedList<Integer> list1 = new LinkedList<>();//链表
    }
}
